package demo;

public class TestJDK7 {
    public static void main(String[] args) {
        try {
            int a = Integer.parseInt(args[0]);
            int b = Integer.parseInt(args[1]);
            int result = a/b;
            System.out.println("result = " + result);
        } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
            System.out.println("数字格式不正确，请输入两个整数");
        }catch (ArithmeticException e){
            System.out.println("第二个整数不能为0");
        }

        System.out.println("你输入了"+args.length+"个参数。");
        System.out.println("你输入的被除数和除数分别是");
        for (int i = 0; i < args.length; i++) {
            System.out.print(args[i]+" ");
        }
        System.out.println();
    }
}
